package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.DishService;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/dish")
@Slf4j
@Api(tags = "用户端菜品接口")
public class UserDishController {
    @Autowired
    DishService dishService;

    @GetMapping("/list")
    public Result list(@RequestParam(required = false) Long categoryId) {
        List<DishVO> list = dishService.getByCagIdWithFlavor(categoryId);
        return Result.success(list);
    }
}
